var t = n = 0,
    count;
$(document).ready(function() {
    count = $("#banner_list a").length;
    $("#banner_list a:not(:first-child)").hide();
    $("#banner_info").html($("#banner_list a:first-child").find("img").attr('alt'));
    $("#banner_info").click(function() {
        window.open($("#banner_list a:first-child").attr('href'), "_blank")
    });
    $("#banner li").click(function() {
		 var v = $(this).text()
		 if (v=='战斗之夜'){
			 v=1
		 }else if(v=='英雄十年 联盟凤凰神'){
			 v=2
		 }else if(v=='五杀摇滚Ⅲ'){
			 v=3
		 }else if(v=='国服十周年庆典'){
			 v=4
		 }else{
			 v=5
		 }
        var i = v - 1;//获取Li元素内的值，即1，2，3，4
		n = i;
        if (i >= count) return;
        $("#banner_info").html($("#banner_list a").eq(i).find("img").attr('alt'));
        $("#banner_info").unbind().click(function() {
            window.open($("#banner_list a").eq(i).attr('href'), "_blank")
        })
        $("#banner_list a").filter(":visible").fadeOut(500).parent().children().eq(i).fadeIn(1000);
        document.getElementById("banner").style.background = "";
        $(this).toggleClass("on");
        $(this).siblings().removeAttr("class");
    });
    t = setInterval("showAuto()", 2000);
    $("#banner").hover(function() {
        clearInterval(t)
    }, function() {
        t = setInterval("showAuto()", 2000);
    });
})

function showAuto() {
    n = n >= (count - 1) ? 0 : ++n;
    $("#banner li").eq(n).trigger('click');
}
var div;
window.onload = function() {
    div = document.getElementById("div");
    div.style.bottom = "0px"
}

function closeWin() {
    var close = document.getElementById("close");
    if (close.innerText == "×") {
        close.innerText = "√";
        div.style.bottom = "-110px"
    } else {
        close.innerText = "×";
        div.style.bottom = "0px"
    }
}
